<?php
session_start();
include('connexion.php');
include('menu.php');



$query =" SELECT * FROM location l JOIN ville v ON l.ville_id = v.ville_id JOIN pays p ON v.pays_id = p.pays_id WHERE user_id = ".$_SESSION['user_id']." ";
$bienList = mysqli_query($connexion, $query);

$bien = mysqli_fetch_array($bienList);


if (isset($_POST['modifier'])) {

		$ville_nom = $_POST['ville'];
		$nom_pays = $_POST['pays'];
		$location_dated = $_POST['date_debut'];
		$location_datef = $_POST['date_fin'];
		$location_couv = $_POST['photo'];
		$location_surface = $_POST['surface'];
		$location_tarifs = $_POST['prixs'];
		$location_tarifj = $_POST['prixj'];
		$location_voie = $_POST['adresse'];
		$location_desc = $_POST['description'];
		$location_id = $_POST['location_id'];

	
		$query = "UPDATE location SET location_dated = $location_dated, location_datef = $location_datef, location_couv = $location_couv, location_surface = $location_surface, location_tarifs = $location_tarifh, location_tarifj = $location_tarifj, location_voie = $location_voie, location_desc = $location_desc WHERE location_id = $location_id ";
		$res = mysqli_query($connexion, $query);
		

		$query = "UPDATE pays SET nom_pays = $nom_pays WHERE location_id = $location_id ";
		$res = mysqli_query($connexion, $query);

		$query = "UPDATE ville SET ville_nom = $ville_nom WHERE location_id = $location_id";
		$res = mysqli_query($connexion, $query);

		header('location:profil.php');


}

include('modifier_bien.html');
?>